﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using AmorCanino.Web.Models.Models;
using AmorCanino.Web.Models.Services;

namespace AmorCanino.Web.Controllers
{
    public class HomeController : BaseController
    {
        public ActionResult Index()
        {
            var homeModel = new HomeService().GetHome();
            CheckForPicture(homeModel.BridablePets);
            CheckForPicture(homeModel.AdoptablePets);

            return View(homeModel);
        }

        public ActionResult Contact()
        {
            return View();
        }

        [HttpPost]
        public ActionResult Contact(ContactUs model)
        {
            if (ModelState.IsValid)
            {
                new MailingService().SendMessage(new Message()
                {
                    Body = model.Asunto,
                    FromEmail = model.Email,
                    Title = string.Format("Contact de {0}", model.Nombre)
                });

                RedirectToAction("ContactSuccess");
            }

            return View();
        }

        public ActionResult ContactSuccess()
        {
            return View();
        }
    }
}